#ifndef xpack_lang_cxx_make_utc_date
#define xpack_lang_cxx_make_utc_date
#pragma push_macro("xuser")
#undef  xuser
#define xuser mixc::lang_cxx::inc
#include"chrono/datetime.hpp"
#include"define/base_type.hpp"
#include"define/classify.hpp"
#include"lang/cxx/private/lut.utc_time.hpp"
#include"lang/cxx/format.hpp"
#include"lang/cxx.hpp"
#pragma pop_macro("xuser")

namespace mixc::lang_cxx{
    template<class item_t, class the_t = cxx<item_t>>
    inline void make_utc_date_core(utc_date_t const & lut, inc::datetime const & datetime, auto const & alloc){
        uxx year           = datetime->year;
        uxx i_month        = datetime->month - 1;
        uxx day            = datetime->day;
        uxx hour           = datetime->hour;
        uxx minute         = datetime->minute;
        uxx second         = datetime->second;
        uxx i_week         = uxx(datetime->day_of_week());

        inc::c08{"\v, \v \v \v \v:\v:\v GMT"}.format(
        //               ^   ^  ^  ^  ^  ^  ^
        //               |   |  |  |  |  |  |
        //               |   |  |  |  |  |  秒
        //               |   |  |  |  |  分
        //               |   |  |  |  时
        //               |   |  |  年
        //               |   |  月份
        //               |   几号
        //               星期
            lut.weekday[i_week], 
            inc::v{day   }.r(2, '0'), 
            lut.month[i_month], 
            inc::v{year  }.r(4, '0'), 
            inc::v{hour  }.r(2, '0'), 
            inc::v{minute}.r(2, '0'), 
            inc::v{second}.r(2, '0'), 
            alloc
        );
    }

    template<class item_t>
    template<inc::is_datetime datetime_t, class xalloc_t, class ret_t, class>
    inline cxx<item_t>::cxx(utc_date_t const & lut, datetime_t const & datetime, xalloc_t const & alloc) : cxx<item_t>(){
        auto allocx         = the_t::helper::stream_helper(alloc, xmodify(m_ptr), xmodify(m_length));
        make_utc_date_core<item_t>(lut, datetime, allocx);
    }
}

#endif
